package peoplesoftsimulator;

import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.file.StandardOpenOption;

public class XmlReader
{

	/**
	 * @param xmlSource : The XML string to be taken in
	 * @param fileLocation : The fileLocation that the XML is to be written to.
	 * @throws IOException : Throws an expection if an invalid file path is identified.
	 */
	public static void stringToDom(String xmlSource, String fileLocation) throws IOException
	{
		/**
		 * pathXMLFile is an object representing the Path to get to the defined file location.
		 * Files.write will write the bytes of the XML to the fileLocation, creating the file.
		 */
		Path pathXMLFile = Paths.get(fileLocation);
		Files.write(pathXMLFile, xmlSource.getBytes(), StandardOpenOption.WRITE, StandardOpenOption.CREATE);
	}
}
